package controller;

import domain.Student;
import service.StudentService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/showstudent")
public class ShowStudent extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //调用
        StudentService service = new StudentService();
        List<Student>all =service.findAll();

        req.setAttribute("all",all);
        req.getRequestDispatcher("/show.jsp").forward(req,resp);



    }
}
